package com.jerry.api.controller;

import com.github.xiaoymin.knife4j.annotations.DynamicParameter;
import com.github.xiaoymin.knife4j.annotations.DynamicResponseParameters;
import com.jerry.api.service.StudentEmploymentService;
import com.jerry.common.core.controller.BaseController;
import com.jerry.common.core.domain.AjaxResult;
import com.jerry.manager.domain.Students;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;


/**
 * @Date: 2025/6/1 19:34
 * @Created: by 王永发
 * @Description: StudentEmploymentController
 */

@Api(tags = {"学生就业"})
@RestController
@RequestMapping("/api/se")
public class StudentEmploymentController extends BaseController {
    @Autowired
    private StudentEmploymentService studentEmploymentService;
    // 对职业进行分类, 构成一个就业去向
    private final String[][] employmentType = {
            /* 自主创业 */      {"自主创业"},
            /* 深造 */         {"已上二学位", "已上硕", "已上博士后"},
            /* 自由职业 */      {"签就业协议", "签劳动合同", "三资企业", "其他企业", "国有企业", "机关", "医疗卫生单位", "城镇社区", "中初教育单位", "高等教育单位", "科研设计单位", "农村建制村", "部队"},
            /* 其他  */        {"其他形式就业", "已出国", "其他事业单位", ""}
    };
    private final String[] xueli = {"全部", "本科", "硕士", "博士"};

    /**
     * 查询毕业生就业去向的总人数，分为自主创业、深造、自由职业、其他
     *
     * @return 返回长度为4的数组, [0]自主创业, [1]深造, [2]自由职业, [3]其他
     */
    @GetMapping("/dr")
    @ApiOperation("查询毕业生就业去向占比")
    @DynamicResponseParameters(properties = {
            @DynamicParameter(name = "total", value = "总记录数"),
            @DynamicParameter(name = "code", value = "状态码，200正确，其他错误"),
            @DynamicParameter(name = "rows", value = "返回业务数据（数组类型）", dataTypeClass = Students.class),
            @DynamicParameter(name = "msg", value = "返回消息内容")
    })
    public AjaxResult dr() {
        Map<String, Long> map = studentEmploymentService.selectDr();
        Long[] longs = {map.get("0"), map.get("1"), map.get("2"), map.get("3")};
        return AjaxResult.success(longs);
    }
}
